<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text">
<input type="button" value="按钮" onclick="f()">
<div>这是div</div>
<span>这是span</span>
<p id="p1">p1</p>
<p id="p2">p2</p>

<script>
  function f() {
    //得到div
    let d = document.querySelector("div");
    //修改div的文本内容
    d.innerText = "今天星期五";
    //得到span
    let s = document.querySelector("span");
    s.innerText = "值改变了!";

    let p1 = document.querySelector("#p1")
    p1.innerText = "p1变了"
    let p2 = document.querySelector("#p2")
    p2.innerText = "p2变了"
    //得到文本框
    let i = document.querySelector("input");
    //修改控件的值
    i.value = "我是文本框";
  }
</script>
</body>
</html>